<?php
class Address_Model_Category extends Zend_Db_Table_Abstract
{
	protected $_name = 'address_category';
	
	public function insert(array $data)
	{
		//TODO : code to clean data before insert here
		parent::insert($data);
	}
	
	public function update(array $data, array $where)
	{
		//TODO : code to clean data before update here
		parent::update($data, $where);
	}
	
	public function fetchById($id)
	{
		$row = $this->find((int)$id)->toArray();		
		return $row;
	}

	public function fetchParentCategories()
	{
		return $this->fetchAll(array('parent = ? '=>0,'isvisible'=>1))->toArray();
		
		//TODO : if connected
		return $this->fetchAll(array('parent = ?'=>0))->toArray();
		//return $rows;
	}
	
	public function deleteById($id)
	{
		return $this->delete('id = '.(int)$id);
	}
}
